Method and system for matching unknown software component to known software component

ABSTRACT

A computer system or method identifies components. A component fingerprint storage is configured to memorize known fingerprints of known components. The term “component” used herein is defined to be a specific version of pre-existing executable software, or a reusable pre-existing self-contained software code building block which is not a complete stand-alone finished product ready for use and which is binary or source code. A fingerprint is generated for a normalized unknown component and fingerprints are generated for all normalized components included in the unknown component. It is determined whether any of the fingerprints generated for the normalized unknown component and for the normalized components included in the unknown component match any of the known fingerprints of known components.

TECHNICAL FIELD

The technical field relates in general to software development, and morespecifically to providing information about software components used insoftware development.

BACKGROUND

Identifying components that are incorporated into software applicationscan be problematic. Typically applications today are built using variouscomponents and are not written from scratch. All software developers, inwhatever language and platform, whatever methodology, will realize thatthere is some software that they do not want to write and that alreadyexists. What frequently happens is that software developers will usesoftware components directly, e.g., from a repository. Identifying theunknown component that was used as-is directly from a repository is veryeasy because the entire file can be fingerprinted (such as by hashing)and if the hashes are the same then it is known that the entire file isthe same.

What also is common is that software developers modify these componentsin subtle ways. For example, the components might be recompiled from theoriginal source to make them compliant with licensing. When that isdone, there is a subtle change when considering the file as a whole(such as due to the compiler time stamp) even through the functionalcontents are essentially the same. Another example is the OSGI (OpenServices Gateway Initiative) framework for Java, in which additionalmetadata is added to the components themselves to make them work incertain environments. In an OSGI situation, 99.9% of the contents may bethe same as the original source. However, even a minor change willresult in a different hash and thus a determination that the files arenot the same.

SUMMARY

Accordingly, one or more embodiments provide a computer system. Thecomputer system includes a component fingerprint storage configured tomemorize known fingerprints of known components; and a processorcooperatively operable with the component fingerprint storage. Theprocessor is configured for generating a fingerprint for an unknowncomponent and fingerprints for all components included in the unknowncomponent. The processor is also configured for determining whether anyof the fingerprints generated for the unknown component and for thecomponents included in the unknown component match any of the knownfingerprints of known components.

An embodiment further generates the known fingerprints of knowncomponents and then storing the known fingerprints in the componentfingerprint storage.

In another embodiment, the fingerprints are hash values.

Yet another embodiment normalizes the unknown component and all of thecomponents included in the unknown component, before generating thefingerprints for the unknown component and the components included inthe unknown component.

In another embodiment, for each of the components in the unknowncomponent, before normalizing the component, a type of the component anda normalization process associated with the type of the component aredetermined. The component is normalized according to the normalizationprocess determined to be associated with the type of the component.

In still another embodiment, the normalization process for a componentwhich is determined to be a Java type performs the following: set classversion to 0, reset synthetic class access flags, set outer class nameto null, set constant pool and inner class list in alphabetical order,reset final access flag of Java enumerations #values method, remove allsynthetic member fields and Java methods, and remove all package names.

Another embodiment includes preparing a matching confidence value basedon matching of the unknown component and all of the components includedin the unknown component to any of the known fingerprints, wherein thematching confidence value expresses a level of confidence that theunknown component and a known component which is associated with amatched one of the known fingerprints are the same.

A further embodiment is a computer-implemented method for identifying acomponent, according to one or more of the above embodiments.

Still another embodiment is a non-transitory computer-readable mediumcomprising instructions for execution by a computer, the instructionsincluding a computer-implemented method for providing a method foridentifying a component, the instructions for implementing the method ina processor.

Yet another embodiment is a system, computer-readable storage medium, ora computer-implemented method for generating a universal fingerprint fora Java component. The following are performed, in this order: (1) for aJava component, in a processor, normalizing the Java component accordingto a Java normalization process to provide a normalized Java component;and (2) generating, in the processor, the fingerprint for the normalizedJava component, as a universal fingerprint. The fingerprint is a hashvalue. The Java normalization process performs the following on the Javacomponent: setting class version to 0, resetting synthetic class accessflags, setting outer class name to null, setting constant pool and innerclass list in alphabetical order, resetting final access flag of Javaenumerations #values method, removing all synthetic member fields andJava methods, and removing all package names.

Moreover, the purpose of the foregoing abstract is to enable the U.S.Patent and Trademark Office and the public generally, and especially thescientists, engineers and practitioners in the art who are not familiarwith patent or legal terms or phraseology, to determine quickly from acursory inspection the nature and essence of the technical disclosure ofthe application. The abstract is neither intended to define theinvention of the application, which is measured by the claims, nor is itintended to be limiting as to the scope of the invention in any way.

BRIEF DESCRIPTION OF THE DRAWINGS

The accompanying figures, where like reference numerals refer toidentical or functionally similar elements and which together with thedetailed description below are incorporated in and form part of thespecification, serve to further illustrate various exemplary embodimentsand to explain various principles and advantages in accordance with theembodiments.

FIG. 1 is a data flow diagram illustrating evaluating an unknowncomponent for a match;

FIG. 2 is a data flow diagram illustrating adding a fingerprint of aknown component to a dataset of known fingerprints;

FIG. 3 is a block diagram illustrating relevant portions of a computersystem;

FIG. 4 is a block diagram illustrating a software repository;

FIG. 5 is a flow chart illustrating a procedure to evaluate whether acomponent matches an already known component;

FIG. 6 is a flow chart illustrating a procedure to prepare the datasetof known fingerprints; and

FIG. 7 is a flow chart illustrating a procedure to normalize a Javacomponent.

DETAILED DESCRIPTION

In overview, the present disclosure concerns software development, inwhich software code building blocks, sometimes referred to as binary orsource code, or generally software “components”, which are stand-alonepre-determined self-contained pieces of code, can be used as one ofplural building blocks in a complete piece of software, which itself maybe a “component”. Even though a software component might be changedduring the process of developing a piece of software, when it isincluded as part of a complete piece of software it may be desirable toidentify the components within the complete piece of software as beingessentially the same as a known component. More particularly, variousinventive concepts and principles are embodied in systems, devices, andmethods therein for evaluating a software component, and componentswithin the software component, to determine whether it matches analready known component.

The instant disclosure is provided to further explain in an enablingfashion the best modes of performing one or more embodiments. Thedisclosure is further offered to enhance an understanding andappreciation for the inventive principles and advantages thereof, ratherthan to limit in any manner the invention. The invention is definedsolely by the appended claims including any amendments made during thependency of this application and all equivalents of those claims asissued.

It is further understood that the use of relational terms such as firstand second, and the like, if any, are used solely to distinguish onefrom another entity, item, or action without necessarily requiring orimplying any actual such relationship or order between such entities,items or actions. It is noted that some embodiments may include aplurality of processes or steps, which can be performed in any order,unless expressly and necessarily limited to a particular order; i.e.,processes or steps that are not so limited may be performed in anyorder.

Much of the inventive functionality and many of the inventive principleswhen implemented, are best supported with or in software or integratedcircuits (ICs), such as a digital signal processor and softwaretherefore, and/or application specific ICs. It is expected that one ofordinary skill, notwithstanding possibly significant effort and manydesign choices motivated by, for example, available time, currenttechnology, and economic considerations, when guided by the concepts andprinciples disclosed herein will be readily capable of generating suchsoftware instructions or ICs with minimal experimentation. Therefore, inthe interest of brevity and minimization of any risk of obscuringprinciples and concepts, further discussion of such software and ICs, ifany, will be limited to the essentials with respect to the principlesand concepts used by the exemplary embodiments.

DEFINITIONS

The claims may use the following terms which are defined to have thefollowing meanings for the purpose of the claims herein. Otherdefinitions may be specified in this document.

The term “component” used herein is defined to be a specific version ofpre-existing executable software, or a reusable pre-existingself-contained software code building block which is not a completestand-alone finished product ready for use and which is binary or sourcecode. A component is the subject of a license or a target of a securityvulnerability. Less formally, a component which is part of a stand-aloneproduct can be understood to be a self-contained bit of code which adeveloper does not wish to write himself/herself as part of thestand-alone product, and so the developer uses a previously existingcomponent for which the functionality likely was previously vetted as apart of another stand-alone product.

The term “computer system” or “computer” used herein denotes a devicesometimes referred to as a computer, laptop, personal computer, personaldigital assistant, notebook computer, personal assignment pad, server,client, mainframe computer, or evolutions and equivalents thereof.

“Open source” software is defined herein to be source code that allowsdistribution as source code as well as compiled form, with awell-publicized and indexed means of obtaining the source, optionallywith a license that allows modifications and derived works.

The term “Open Source Definition” is used herein to mean the Open SourceDefinition available from the Open Source Initiative, variations andevolutions thereof.

The term “repository” or “software repository” used herein are definedto mean an electronic storage system that stores software buildcomponents (sometimes referred to as an “artifact”) and dependencies forlater retrieval, to which artifacts are published in accordance withprocedures which are well known to those in the field, so that artifactsmade by one software developer are published to be available for furtheruse by other software developers, to be incorporated as building blocksto build software products which can be executed; a repository caninclude a computer server by which the stored electronic copies ofartifacts are made available for use by software developers to beincorporated as building blocks to build software products which can beexecuted; the repository typically has a unique identifier thatindicates the software developer (an individual or a group) thatcontributed the artifact. A repository can be remote or local.

The term “software build” used herein specifically is defined to mean aprocess as pre-defined in an executable build program of converting aplurality of components (sometimes obtained from a repository) andcombining the results into an executable stand-alone computer program ora software component for use in a further software build, including atleast compiling components and linking compiled components and possiblybinary components (which can be from the repository), in apre-determined order as defined in the build program.

The term “compiler” is used herein specifically to mean a computerprogram(s) that transforms source code written in a programming languageinto a target language that is readable by a computer, often in the formof binary code or bytecode, so as to create an executable program.

END OF DEFINITIONS

The inventors faced the problem of finding a way to determine whetherthe contents of the components are the same or almost the same asanother known component, so as to be able to report to a user (1) thatthis known component is being used, and/or (2) that this component hascertain license obligations and/or potential security vulnerabilities,or other associated metadata. The fact that the component has beenmodified does not change the fact that it is subject to a copyleftlicense or that it has known security vulnerabilities. It is stillrelevant even through the components are not identical, they areeffectively the same.

Consequently, a solution is to identify the component at a more granularlevel than just at the file level. In this solution, domain-specificlogic can be applied to the contents of the file, so that the system canunderstand the semantic meaning of the file, so even though the filebeing evaluated may be slightly different and have a different hash, auser can know that the file is essentially the same.

Instead of merely evaluating the outer file, depending on the file typethe system looks inside the file. For example, if the file is anarchive, the system can look inside the archive and look at each of thearchive entries. Furthermore, again depending on the type of thecomponent, the system can apply additional domain logic that isapplicable to that particular file type. For Java, the system appliescertain pre-determined bytecode normalizations so as to be able toidentify files that semantically are identical. By way of explanation,it can be noted that actual bytecode instructions can be slightlydifferent depending on factors involved in how the files were compiled,how they were post-processed by certain tools, or similar. Normalizingindividual components to account for, e.g., compiler and/or build“noise” can allow the system to tell that non-identical files areactually the same or came from the same source or are very close tobeing the same source.

In this discussion, the term “unknown component” is used to refer to acomponent which is to be evaluated (as disclosed herein) to determinewhether it appears in the library of known component fingerprints. Theterm “known component” is used to refer to a component which waspreviously evaluated and for which a fingerprint is stored in thelibrary.

In overview, one or more embodiments can normalize the file to beevaluated (referred to as the “unknown component”), which can includedetermining how to normalize the unknown component based on the type ofthe file and doing the same for every component included in the filedown to the innermost component, then producing the fingerprints for thefile and its components; and comparing the fingerprints from the fileagainst the known set of fingerprints. Then, a confidence value can bedetermined which indicates how confident the system is that the file(including its internal components) and the known components are thesame.

As further discussed herein below, various inventive principles andcombinations thereof are advantageously employed to evaluate andidentify components such as third party code included in a softwareapplication. The components such as third party code can come frompublic software component repositories, like The Central Repository(from Sonatype), or elsewhere, from which a library of known componentfingerprints can be generated. The library of known componentfingerprints can be searched for a match of the fingerprint of theunknown component.

Further in accordance with exemplary embodiments, there is provided amethod and system for identifying third party code which is included infiles. A software application can be viewed as a collection of files.Files can include other files, as is the case with ZIP archives. Filescan have subelements, for example, a Java class file can be viewed as acollection of member fields and functions.

In an exemplary embodiment, for each application file which needs to beidentified, the system can calculate a SHA1 hash of the file contentsand, depending on the file type, a number of SHA1 hashes of normalizedfile contents. Each hash function can be assigned a match confidencelevel, e.g., a number between 0 and 100. For example, an SHA1 of theentire file contents can be considered to have confidence of 100, whileadditional hashes can have lower confidence depending on the level ofnormalization performed on the component or sub-component beforehashing.

For files with recognized subelements, e.g., a Java class, the systemcan calculate SHA1 hashes of the normalized subelement contents.

File content normalization processes can be performed which is specifiedto the different types of components (files and subelements) beforecalculating the hash of the file. The following are examples of filenormalization processes:

Text Files

-   -   replace all sequences of whitespace characters with a single        space character.

XML Files

-   -   remove whitespace nodes    -   convert to UTF-8 (UCS Transformation Format—8 bit) character        encoding

Java Files

-   -   Class version set to 0. Class version varies depending on-target        Java compiler parameter. Setting to 0 makes the class version        compiler-independent.    -   Reset synthetic class access flags. Different Java compilers set        these flags differently. Resetting the flags makes the class        access compiler-independent.    -   Set ‘outer’ class name to null. Different Java compilers set        this attribute differently. Setting to null makes the outer        class name compiler-independent.    -   Sort constant pool and inner class list in alphabetical order.        Pack and unpack (e.g., pack200/unpack200) change the constant        pool and inner class list order. <The pack200 tool is a known        Java application that transforms a JAR (Java archive) file into        a compressed pack200 file using the Java gzip compressor. The        pack200 files are highly compressed files that can be directly        deployed><unpack200 is a known tool that decompresses a packed        file produced by pack200 into a JAR file.>Packing and unpacking        makes the constant pool and inner class list        compiler-independent.    -   Reset ‘final’ access flag of Java enumerations #values method.        Different Java compilers set this flag differently. Resetting        this flag makes it compiler-independent.    -   Remove all synthetic member fields and methods. Again, this        removes compiler dependent information.    -   Remove all package names. This normalization compensates for        Java classes ‘relocation’ performed by the maven-shade-plugin.

A database of known hashes can be calculated from components such ascustomer application files located by crawling public software componentrepositories, like The Central Repository.

Hashes of customer application files can be calculated and matchedagainst the database of known software hashes. Each application file ismatched individually first, starting with matching individual filesubelements, where applicable. If a match is found, it is assigned ascore based on match confidence of the hash function used to calculatethe hash. Matching score of archive files is calculated based ofmatching score of individual files included in the archive.

Scores above a certain threshold indicate that customer applicationlikely includes the matching known software component.

The data flows are illustrated herein by way of example to furtherunderstanding of the principles discussed here. Actual implementationscan omit one or more portions of the data flows, and/or can includeother data flows which are within the scope and spirit of the discussionherein.

FIG. 1 and FIG. 2 are both data flow diagrams. FIG. 1 illustrates a dataflow for evaluating and attempting to identify a component using afingerprint of the component, and FIG. 2 illustrates a data flow forstoring information in the library of known fingerprints. An overview ofthe processes of FIG. 1 is first provided, followed by a more detaileddiscussion of variations. Then, an overview of FIG. 2 and a subsequentdetailed discussion thereof are provided.

Referring now to FIG. 1, a data flow diagram illustrating evaluating anunknown component for a match will be discussed and described. In FIG.1, the data flow generally provides normalizing and generating afingerprint 101, 103, 105 for each part of an unknown component 113which is to be evaluated; and then finding a match for the fingerprint107. The data flow related to each component is illustrated byrespective vertical lines, the top of which is connected to thecomponent to which it pertains. Optionally, a matching confidence valueis scored 109. These are discussed in more detail below.

In this illustration, the unknown component 113 which is to be evaluatedhappens to be an executable software application. Those of skill in theart will appreciate that the unknown component includes a variety ofother components which were incorporated by the software developers,perhaps open source files, class files, libraries, executable code thatwas recompiled, code that was patched, OSGI framework elements, archivefiles that contain other components, and perhaps original elements aswell, and the like. In this illustration, these are componentsrepresented by component A, recompiled component B, component C,component F, components P-R, component X and component Y 119, 121, 123,125, 127, 129, 131, 133, 135. A component can be included within anothercomponent, in this illustration, components X and Y are inside componentF 131, 133, 135; component R is inside component Q (and thus is insidecomponent A) 119, 123, 125; components P and Q are inside component A119, 121, 123; and all of these components are inside the unknowncomponent 113. Naturally, before any of the components is matched itneeds to be evaluated; however, for each of description in this example,we will use the same name for the component before and after matching isperformed.

Briefly, the illustration shows that, for each component, its type isdetermined and the normalization process 115 associated with that typeis determined 101. Each component is individually evaluated, becausethey may each have a different type. For example, component A may be aZIP file, and recompiled component B may be a Java file. As part ofthis, files which contain other files (e.g., a ZIP file) are opened andthe components therein are also normalized, etc. Here, there is anassociated normalizing process determined for each component: theunknown component. component A, recompiled component B, component C,component F, components P-R, component X and component Y 113, 119, 121,123, 125, 127, 129, 131, 133, 135.

After identifying the normalization process to be used for eachcomponent, each component is normalized 103 by the associatednormalization process 115, which results in normalized components. Thenormalization process is intended to remove information that may beadded during software development that does not materially affect thesemantics of the file, or may otherwise obscure the file contents orfile data. A variety of normalization processes 115 can be provided,with one or more for each different type of file that is expected to beevaluated. Here, there is generated a normalized component correspondingto each component, illustrated by the vertical dotted line: the unknowncomponent. component A, recompiled component B, component C, componentF, components P-R, component X and component Y 113, 119, 121, 123, 125,127, 129, 131, 133, 135.

After the component is normalized, a fingerprint is generated for eachnormalized component based on the normalized contents 105. Here, eachthere is a fingerprint generated for each normalized component,represented by the vertical double line: the unknown component.component A, recompiled component B, component C, component F,components P-R, component X and component Y 113, 119, 121, 123, 125,127, 129, 131, 133, 135.

Details of normalizing and generating fingerprints are further discussedin a subsequent section.

After a fingerprint is generated, a match is attempted to be located 107in the library 117 of fingerprints of known components. Either thefingerprint will match one of the known components, or it won't. Here,for each component, there is an indication provided as to whether or notthe fingerprint of a normalized component matched a fingerprint in thelibrary. In this case, there was no match (indicated by the “X” on thevertical double line) for: the unknown component, component P, componentA, and component F 113, 119, 121, 131; and there is a match for:recompiled component B, component C, component Q, component R, componentX and component Y 123, 125, 127, 129, 133, 135.

The components with fingerprints that are matching in the library 117correspond to those known components that were listed in the library.Having identified these components as the same, these components willhave the same issues, such as license, support, security, and the like.This means also that the unknown component will have those same issues.

It can be appreciated that the normalization process for the recompiledcomponent B 127 in this example removed any data introduced by therecompilation, since the fingerprint of normalized recompiled componentB was located in the fingerprint library 117. The fingerprint ofnormalized component A 119 was not located in the fingerprint library117, likely because component A 119 includes component P 121 which alsodid not match any fingerprint in the fingerprint library. If component Ahad previously been encountered, all of its internal components wouldalso have been recorded in the library. The fingerprint of component F131 was not located in the library 117, despite all of its internalcomponents, here represented by components X and Y 133, 135, havingfingerprints that are matched in the library 117. Perhaps component F131 was patched or was changed to a different framework than itsoriginal.

Details of fingerprint matching are discussed in a subsequent section.

Then a matching confidence value can be prepared 109 based on thefingerprints of the normalized that matched fingerprints in thefingerprints library 117. Based on the normalization technique that wasused, the confidence value can be enhanced (for example, where theentire file was hashed) or penalized (for example, where merely the filesignature was hashed).

In addition, the matching confidence value can consider whether thecomponent contains fingerprints that match a known component thatcontains the same fingerprints. For example, component F 131 containsmatched fingerprints for component X and component Y; thus component Fmight match (with a lower matching confidence value) a known componentthat also contains component X and component Y (illustrated as componentD2 31 in FIG. 2). Similarly, unknown component 113 might be consideredto be approximately matched to the known component 213 of FIG. 2 becausesome of the internal fingerprints are matched; the score for thematching confidence value can reflect the number of matched fingerprintsand unmatched fingerprints, and optionally the normalization processesthat were used.

Similarly, if component A 119 is simply an archive, it will not matchbecause one of its internal components does not match (here, component P121). If component A is simply an archive, its failure to match shouldnot affect the matching confidence value because that would amount todouble-counting the failure to match component P.

Then, the matching confidence value 111 for the unknown component can beprovided. Optionally, information regarding the matches for the internalcomponents can be provided as well.

A detailed discussion regarding scoring of the matching confidence valueis provided in a subsequent section.

Normalizing and Generating Fingerprints

Often, in some cases, the system is able to look further inside files.For Java class files, for example, the system can look at individualmembers of the class and again apply the same approach discussed herein.The file is normalized and hashes of individual members inside the fileare calculated, and those hashes can be compared to the database ofknown member hashes that were previously collected.

Any hash function technique can be used. Well known hash techniquesinclude SHA-1, MD5, and many others that will map an input data set ofvariable length and output a small data set, sometimes referred to as ahash value, hash code, hash sum, check sum, or hash.

The hash function is not important as long as the same technique is usedto hash the file being evaluated and the known file to which it iscompared. The file that is input to the hash function is normalized sothat the input is the same despite differences, some of which aresubtle, that are injected as part of the process of developing code.

The system can be useful with compiled files. On a source file, somenormalization can be done to identify, e.g., end-of-line characters thatmay be different (depending on the editor implementation) in the bitfile that will be hashed but do not affect the semantics of the filecontents. For XML files and unformatted files, normalization is appliedto adjust for characters and/or white space nodes. It is expected thatfiles which are reviewed are most often compiled applications. In acompiled application that is being evaluated, the system is trying tocompare two components which have been modified by, e.g., a compiler andtrace them back to determine that these two apparently differentcomponents likely originated from the same source code.

With regard to compilers, running a compiler at a different time or witha slightly different set of parameters or running a different compileror a compiler with a different set of parameters, on the same sourcecode, can yield a slightly different set of bytecode. Also, the compiledcode might include a portion of bytecode that is random and essentiallydifferent every time the code is compiled. A compiler is obliged togenerate exactly the same code for the same input, but even differentversions of the same compiler can generate slightly different code foridentical input.

Two components can be different while being the same semantically, forexample, the same source has been through different compiler versions orthe same compiler with different options. That two components are“semantically” the same means that the bytecodes, although different,were compiled from exactly the same source or using same compiler orwith different options, or different versions of the same compiler,and/or using the same or different build tools. To this point, the merefact of re-compiling changes an outer archive's hash due to the changedtime stamp. One question to be answered in the matching is whether thetwo components being compared are different compiles of the same source.The normalizing process is intended to mitigate such differences whichare created as a by-product of the usual course of implementingsoftware.

One or more normalization techniques can look for cases where theindividual class files and contents themselves are slightly altered,and/or where the bulk of the archive itself is the same with some subtlechanges such as when a file was patched or a manifest is added. Asdiscussed below, the system can say with some confidence that thesedifferent outer files are the same, when every other component in therespective files is identical.

The system further can associate the normalization process with aconfidence value, so that the system can rank the quality of the matchdeveloped from the normalization process.

The normalization process which is selected and performed can bedependent on the detected content of the file, and there are a set ofnormalization algorithms which can be done. For example, to normalizestext files, the system can remove the white space, line endings, etc.For Java files, a number of specialized things are done to normalize thebytecode. The system can normalize other types of components, e.g., .netcomponents. The approach can be similar, i.e., to ascertain and removeinformation added by the .NET compilers to the semantically functionalparts of the code.

A variation is to compile known source code to provide compiled sourcecode, and then compare the resulting output of the known compiled sourcecode to the unknown compiled component.

The system can determine which kind of normalization to do based on thefile type (e.g., the file extension as confirmed by the file contents)of the subcomponent.

In normalization, a first step is identifying the type of file and anext step can be to normalize the file. The system knows what types ofcomponents represent archives. If a component is determined to be anarchive, then it contains other components; the component that is anarchive is opened up and the process is performed on the componentscontained in the archive. If the component is a Java class file, abytecode normalization for Java or for a Java class file is applied. Ifthe component is a text file, the system performs a text filenormalization. The system walks down the tree until it has files whichare not archive files and then the system handles the individual files.An “Archive file” is defined herein as a file type that is known tocontain other files. Examples of an “Archive file” are a zip file, a JARfile, and the like.

One or more normalization processes can be used on a component, togenerate respective one or more hashes for a single component.

A hash function is performed on each normalized component, including thefile to be evaluated as a whole, each component within the file to beevaluated, each component within one of the components, and so on (each,a “subcomponent”). The hash function generates fingerprints.

Matching

The system can check whether there is an exact match between fingerprintof any known component and the fingerprint of the unknown component (orsubcomponent). Even if the unknown component as a whole has a matchingfingerprint, the system still evaluates the interior components of theunknown component for matching fingerprints. There is a smallpossibility of a false positive match of just the unknown component as awhole, and moreover there may be security or license implications of theinternal component that may not have been noted with respect to, e.g.,the executable component package.

A known component can have a provenance because it may have beenretrieved from source, such as a software repository, for example, TheCentral Repository, or other structured storage that associates thecomponent with its license(s), build settings and environment,contributor, and/or which may be able to associate the component withvulnerabilities, security updates and the like. Once the unknowncomponent (or its subcomponents) is matched to a known component, theunknown component can be associated with the provenance of the knowncomponent (and its subcomponents) and hence the issues related toprovenance (e.g., licenses, security, etc.) can be addressed in theunknown component.

Even if there is a perfect match at the outer file level, there arematches at the subelement which are relevant as well (e.g., archive orclass file, etc.). So, fingerprints are generated and matches aredetermined for the unknown component at all of these levels (innermostfile subelements, all file sub-elements, and the unknown componentoverall).

Any known or to-be-developed techniques can be used for comparing hashvalues and attempting to locate a matching hashed value.

Scoring the Match Confidence

To score the match, the system can look at the unknown component as ahierarchy, and the system can drill inside the unknown component andevaluate the individual JAR files (more generically, archive files) orcomponents within the distribution. When a component is an archive file,the system can drill down to look at individual entries within thecomponent, so as to evaluate the individual sub-elements of thoseentries. At each level, the system can calculate the hashes and cancompare those hashes to the database library of known hashes.

Certain normalizations lose more information about the input componentthan the others. For example, one normalization process for Java classfiles is to remove all bytecode from the component and only keepinformation about method names and their parameters, that is, just thefile signature. The hash that is calculated when this normalizedcomponent is used (i.e., using just the file signature) is based on areduced amount of information; this can have a lower match confidencethan a hash that was calculated based on more information (even ifnormalized) or based on the entire non-normalized component. Thus, thesystem can weight the score based on the type of the normalizationfunction that was used, with those normalization process that lose moreinformation about the input component being weighted lower than theother normalization process that do not lose more information.

For each component that is to be evaluated, the system can use the innermost elements. For example, for Java classes, the system can look at,e.g., individual methods and can calculate matched confidence at thatlevel. Then, for each individual Java method the system can have anumber of hashes calculated, so the system can find the matched hashwith the highest confidence. The system can aggregate this informationup at the class file level (which is a collection of methods and membersand member fields). There, the system can calculate total confidence ofall the elements and weight this by the number of elements. Then, thisis aggregated up to the level of individual application archive files(or JAR files).

When the system determines whether a known archive is the same as theunknown archive, the system can consider both sides to this comparison.That is, the scoring can consider how many matched components are in theknown archive vs. in the unknown archive. An unknown archive in which99% of its components match a known archive is more likely to match theknown archive, with perhaps a minor variation such as caused by a patchto one element.

In a variation, the system can use a text file that is a subcomponent ofthe unknown component, to boost the overall matching score when thefingerprint of the text file component is matched.

In another variation, the system can provide one or more potentialmatches and associated confidence values for the unknown component. In avariation, the system can provide the potential match(es) and confidencevalues for components inside the unknown component. In a variation, thepotential matches can be limited to those with a confidence value over apredetermined threshold value.

Referring now to FIG. 2, a data flow diagram illustrating adding afingerprint of a known component to a dataset of known fingerprints willbe discussed and described. In FIG. 2, the data flow generally providesfor obtaining a known component 213, normalizing and generating afingerprint 201, 203, 205, 207 for each part of the known component 211;and then storing 209 the fingerprint into the library of fingerprints ofknown components 217. The data flow related to each component isillustrated by respective vertical lines, the top of which is connectedto the component to which it pertains. These are discussed in moredetail below.

In this illustration, the known component 213 which is to be evaluatedalso happens to be an executable software application, and a variety ofother components which were incorporated by the software developers, asdiscussed above. In this illustration, these are components representedby components A-D, components Q-S, component X and component Y 219, 221,223, 225, 227, 229, 231, 233, 235. Components X and Y are insidecomponent D 231, 233, 235; component R is inside component Q (and thusis inside component A) 219, 223, 225; components S and Q are insidecomponent A 219, 221, 223; and all of these components are inside theknown component 213.

After the known component is obtained, its type and the type of eachcomponent inside the known component is determined and the associatedone of the normalization processes 215 for each component is determined203. This can be the same as described in connection with FIG. 1. Then,each of the components can be normalized 205 by the one (or more) of thenormalization processes for the type of the component, to generatenormalized components. This can be the same as described in connectionwith FIG. 1. Next, a fingerprint is generated 207 for each of thenormalized components. This also can be the same as described inconnection with FIG. 1. Finally, the generated fingerprints of thenormalized components can be stored 209 in the library 217 offingerprints of known components, optionally together with informationso that the original of the known component can be located.

Other known components can be obtained and the data flow can be repeatedfor the other known components. Additional discussion follows regardingthe creation of the library of fingerprints of known components.

Creating the Library:

The source of known components can be, e.g., anywhere on the internet,or software repository, or internal commercial artifacts, or opensource, or proprietary (such as intranet), a database, web crawling, oranywhere. The Central Repository is a convenient example of a repositoryof known components, which are Open Source and are specifically intendedto be reused by software developers. However, the known components canbe obtained from anywhere. The known components can provide mastercomponents from which a dataset of known fingerprints is developed, towhich the fingerprints of unknown components are compared.

The library/data set of known fingerprints of known components uses thesame normalization and fingerprinting process described above.Consequently, the same file being input as an unknown component willresult in a matching fingerprint.

The library/data set of known fingerprints of known components can bestored using conventional techniques, such as in a database which islocal, remote and/or distributed. The fingerprints/hashes stored thereincan be search using known techniques. Moreover, the known fingerprintsstored in the dataset of known fingerprints can include an indication(such as a pointer or address) of the provenance of the component thatresulted in the known fingerprint. For example, a known fingerprint thatoriginated in an open source repository can include sufficientinformation to locate that particular version of the component in theopen source repository, together with any build, license and/or securityinformation that is provided in the open source repository.

The fact that there is no match for an unknown component does not meanthat it is necessarily unique. For example, the unmatched unknowncomponent may be a copy of something that was distributed in anothermechanism that was not used in creating the library.

In an embodiment, a fingerprint for an unknown component that does notmatch anything in the storage can be added to the storage for futurematching against new unknown components (since the unknown component hasalready been encountered). For example, if a web crawler is used todevelop the dataset of known component fingerprints, it is possible thatsomething is first encountered as an unknown component prior to beingadded to the library from the web crawler. A fingerprint for anunmatched unknown component can be used to supplement the library.

Referring now to FIG. 3, a diagram illustrating relevant portions of acomputer system will be discussed and described. The computer 301 mayinclude one or more controllers 303, a processor 305, a networkinterface 309 for communication with a network 307, a memory 311, adisplay 315 (optional), and/or a user input device such as a keyboard317. Alternatively, or in addition to the keyboard 317, a user inputdevice may comprise one or more of various known input devices, such asa keypad, a computer mouse, a touchpad, a touch screen, a trackball,and/or a keyboard. The display 315 may present information to the userby way of a conventional liquid crystal display (LCD) or other visualdisplay, and/or by way of a conventional audible device (e.g., aspeaker) for playing out audible messages. Portions of the computer 301are well understood to those of skill in this area and have been omittedto avoid obscuring the discussion.

The processor 305 may comprise one or more microprocessors and/or one ormore digital signal processors. The memory 311 may be coupled to theprocessor 305 and may comprise a read-only memory (ROM), a random-accessmemory (RAM), a programmable ROM (PROM), and/or an electrically erasableread-only memory (EEPROM). The memory 311 may include multiple memorylocations for storing, among other things, an operating system, data andvariables 333 for programs executed by the processor 305; computerprograms for causing the processor to operate in connection with variousfunctions such as to determine 335 the internal components within theunknown component and generate fingerprints for each unknown andinternal component, determine 337 whether the fingerprints of theunknown and internal component matches a known fingerprints, determine339 a type of the component, determine 341 a normalization processassociated with the type of the component, prepare 343 an overallmatching confidence value for the unknown component, search 345 thefingerprint library for a match, get 347 a known component and add itsfingerprint to the library; a temporary work space 349 for the unknowncomponent and its internal components; a temporary memory 351 forstoring fingerprints; and a database 347 for other information and/orinstructions used by the processor 305. The computer programs may bestored, for example, in ROM or PROM and may direct the processor 305 incontrolling the operation of the computer 301. Each of these functionsis considered in more detail herein, to the extent that it is notdetailed elsewhere in this document.

The user may invoke functions accessible through the user input devicesuch as the keyboard 317. The user input device may comprise one or moreof various known input devices, such as a keyboard (317, illustrated)and/or a pointing device, such as a mouse; the keyboard 317 may besupplemented or replaced with a scanner, card reader, or other datainput device; and the pointing device may be a mouse, touch pad controldevice, track ball device, or any other type of pointing device.

The display 315 is representative of a display that may presentinformation to the user by way of a conventional liquid crystal display(LCD) or other visual display, and/or by way of a conventional audibledevice for playing out audible messages.

Responsive to manual signaling from the user input device represented bythe keyboard 317, in accordance with instructions stored in memory 311,and/or automatically upon receipt of certain information via the networkinterface 309, the processor 305 may direct the execution of the storedprograms.

The computer 301 can access a software repository 367 on which is storedone or more components, here represented by component(s) 369, which isrepresentative of one or more masters for preparing the library 319 offingerprints of known components; and the computer 301 can access anunknown component 363, illustrated here as being located in database 361accessed over the network 307. Although the components and unknowncomponent 363, 369 are illustrated as accessed over the network 307, thecomponents and/or unknown component 363, 369 may be remotely and/orlocally accessible from the computer 301, over a wired and/or wirelessconnection; the components and unknown component 363, 369 do not need tobe limited to a database or a software repository. An example of thesoftware repository 367 is The Central Repository, available atSonatype. Techniques are known for accessing components located in asoftware repository 367, and for accessing components located indatabases 361, files, and the like.

The processor 305 may be programmed to determine 335 the internalcomponents within the unknown component and generate fingerprints foreach unknown and internal component. A file can be determined to be an“archive file”, i.e., composed of one or more files and metadata thatcan indicate file directory structure among other things. As usedherein, the designation “archive file” indicates archive files that may(or may not) include compression, be used for software packaging anddistribution, and document packaging and distribution. A non-exhaustivelist of extensions for archive files includes .zip, .cfs, .rar, .sitx,.7z, .tar, .jar, .war, .pkg, .deb, .msi, and the like. The internalcomponents of a component that is an archive file can be determinedusing known techniques, such as the file directory indicated in thearchive file. Each of the internal components from an archive file canitself be examined to determine whether there is another layer ofinternal components. Once the archive file directories and internalcomponents have been exhaustively examined, all of the internalcomponents within the unknown component are located. Optionally, thecomputer 301 can provide a temporary work space 351 for the unknowncomponent and respective internal components. A fingerprint can begenerated for the unknown component and for each of its internalcomponents, and internal components of its internal components.

The processor 305 may be programmed to determine 337 whether any of thefingerprints of the unknown and/or internal components matches a knownfingerprint in the library of fingerprints of known components 319(sometimes referred to as the “known fingerprint library). Conventionaltechniques can be used to compare the fingerprints and attempt to locatea matched fingerprint in the known fingerprint library 319.

The processor 305 may be programmed to determine 339 a type of thecomponent. When provided a component, this function can determined itstype using known techniques. For example, the file extension mayindicate the file type, and the file contents will confirm the file typewhen the file contents are appropriate for the file type.

The processor 305 may be programmed to determine 341 a normalizationprocess associated with the type of the component. Differentnormalization processes 321 can be stored separately, if desired. Theone or more normalization processes associated with the file type areused on the component to generate a normalized component. Normalizationis discussed elsewhere in more detail.

The processor 305 may be programmed to prepare 343 an overall matchingconfidence value for the unknown component, based on the matching andnot matching of the unknown component and its internal components withrespect to the known fingerprints. The scoring of the confidence valueis discussed elsewhere in this document in more detail.

The processor 305 may be programmed to search 345 the fingerprintlibrary for a match. That is, given a fingerprint for the unknowncomponent or its internal components, the known fingerprint library 319can be searched using conventional techniques to determine which, ifany, of the known fingerprints stored in the fingerprint library 319 isa match. If the fingerprints match, then the known and unknowncomponents that were input to the hash were the same.

The processor 305 may be programmed to get 347 a known component and addits fingerprint to the library. The processor 305 for example can crawlthe web for repositories that include components, and normalize thosecomponents, prepare hashes of those components, and store those hashesinto the known fingerprint library 319 together with identifyinginformation that indicates the source of the known component (such as aUID or a component ID from a MAVEN source repository, or similar). It isanticipated that large numbers of components will have theirfingerprints added to the known fingerprint library 319.

The processor 305 may include a temporary memory 351 for storingfingerprints that are being worked on, such as fingerprints of theunknown component 363 and its internal components.

As will be understood in this field, besides the functions discussedabove, the memory 311 can include other miscellaneous information in amisc. database 347, along with the usual temporary storage and otherinstructions for other programs not considered herein.

The computer 301 can accommodate one or more disk drives or removablestorage (not illustrated). Typically, these might be one or more of thefollowing: a flash memory, a floppy disk drive, a hard disk drive, a CDROM, a digital video disk, an optical disk, and/or a removable storagedevice such as a USB memory stick, variations and evolutions thereof.The number and type of drives and removable storage may vary, typicallywith different computer configurations. Disk drives may be options, andfor space considerations, may be omitted from the computer system usedin conjunction with the processes described herein. The computer mayalso include a CD ROM reader and CD recorder, which are interconnectedby a bus along with other peripheral devices supported by the busstructure and protocol (not illustrated). The bus can serves as the maininformation highway interconnecting other components of the computer,and can be connected via an interface to the computer. A disk controller(not illustrated) can interface disk drives to the system bus. These maybe internal or external. The processor 305, memory 311, a disk driveand/or removable storage medium are referred to as “computer-readablestorage media” and provide non-transitory storage of computer programsand data.

It should be understood that FIG. 3 is described in connection withlogical groupings of functions or resources. One or more of theselogical groupings may be omitted from one or more embodiments, forexample, the functionality preparing the fingerprints library by getting347 a known component, preparing the hash, and adding to knownfingerprints can be omitted and/or performed on a different processor.Likewise, functions may be grouped differently, combined, or augmentedwithout parting from the scope. Similarly the present description maydescribe various databases or collections of data and information. Oneor more groupings of the data or information may be omitted,distributed, combined, or augmented, or provided locally and/or remotelywithout departing from the scope.

Referring now to FIG. 4, a block diagram illustrating a softwarerepository will be discussed and described. FIG. 4 discloses a projectobject model (“POM”). The project, e.g., project X 455 includes one ormore components (here represented by Components A and B 451, 453), theproject log 443 for Project X, and metadata for the project X (hererepresented by POM X 401) that identifies project information such ascontributors 433 and licenses 435. The illustrated example is a knownMaven software (currently available at Apache) project object model,which provides a highly structured handling of projects and components,sometimes referred to therein as “artifacts”. Maven is a buildmanagement tool that comprises a project object model (“POM”), a set ofstandards, a project lifecycle, a dependency management system, andlogic for executing plugin goals at defined phases in a lifecycle.

A “Project Object Model” (POM), e.g., POM X 401 is a file provided for aproject 455 that describes, configures and customizes an application andis associated with one or more components by being included in the samedirectory as one or more components. In different build tools or projectmanagement tools, the POM 401 is a file included in a project, e.g.,project X 455, which includes one or more components (represented bycomponent A and component B 451, 453); the POM can be a file with apre-determined name: a Maven pom.xml file, a GNU Makefile, or an Antbuild.xml file. The POM file is typically targeted to Java applications,building JAR components, C# sources, or the like. A software componentcan be associated with a POM in alternative ways, for example, byincluding a link or identification of the associated POM.

The POM 401 can contain description data and configuration data: POMrelationships 403, build setting 405, general project information 407,and build environment 409. General project information 407 includesgeneral data 431 (project's name, the URL for a project, the sponsoringorganization), a list of developers and contributors 433, and/or thelicense (or identifiers of licenses) for the project 455.

The build settings 405 for the project 455 can customize the behavior ofa build 419 by specifying location of directories 421, extensions 423,resources 425 and plugins 427. Also, the build settings 405 can specifyreporting 429 to be used for the POM 401.

The build environment 409 can include settings and profiles that can beactivated when the software comprising the components 451 is built foruse in different environments. For example, during development the builtsoftware is deployed to a development server, whereas in productiondevelopers the built software is deployed to a production server. Thisexample provides build environment information 437, Maven environmentinformation 439, and profiles 441 to be used in different builds.Techniques for executing a build of software are known.

The POM relationships 403 include POM coordinates 411 that specify agroup ID, an artifact ID, and a version number for the project 455 andfor the POM 401. In the conventional Maven system, group ID, artifact IDand version (GAV) uniquely identify each component. The group ID ismeant to identify the individual or organization that published thecomponent. The artifact ID uniquely identifies a component for theGroup, and in accordance with known techniques indicates whatfunctionality the component is addressed to; artifact IDs need not beunique for different groups. The version is the temporal axis for how acomponent changes in accordance with known techniques, e.g., Version 1.0is least mature, and Version 8.2.3 is more mature. Collectively, thegroup ID, artifact ID and version number are sometimes referred toherein as the “GAV”, “Maven coordinate” or “GAV coordinate”. The GAVuniquely identifies a component and allows its dependencies andrelationship to other components to be tracked. The use of the GAVdisambiguates amongst components across various domains of differentgroups.

The POM as used in Maven is discussed in “MAVEN: The Complete ReferenceGuide”, Edition 8 (2010). In a well-written POM, there is a block for“description,” “project”, “URL”, “License”, “Issue tracking”, “authorlist” and the like. Known techniques can be used to construct a POM.

A project, e.g., project X 455 can have a parent, e.g., project Y 457.Project Y 457 is illustrated to include representative component C 459and a POM Y 461. Values which are not specified in the POM in a childproject can inherit values from the POM of a parent project, e.g., whengeneral project information 407 is not specified in the POM X 401 ofProject X 455, the project X 455 can inherit the general projectinformation specified in the POM Y 461 of the parent project Y 457.

Also included in a project 455 is a project log 443. The project log 443can perform known functions, such as recording source code check-in,check-out, update of a component, download of a component from theproject, bugs and related fixes specifying, and similar.

A different project, e.g., project Y 457 includes other components (hererepresented by Component C 459), the project log(not illustrated) forProject Y, and metadata for the project Y (here represented by POM Y461) that identifies project information such as contributors andlicenses.

It is not necessary to use a POM structure according to Maven;alternative implementations of a software repository as a database whichincludes components, their associated licenses and/or build informationand the like will be understood.

FIG. 5, FIG. 6 and FIG. 7 are flow charts illustrating variousprocedures related to the above. Any or all of the illustratedprocedures can advantageously be implemented on, for example, aprocessor of a controller, described in connection with FIG. 3 or otherapparatus appropriately arranged.

Referring now to FIG. 5, a flow chart illustrating a procedure 501 toevaluate whether a component matches an already known component will bediscussed and described. Many of the relevant details have already beendiscussed, so this provides an overview. In overview, the procedure 501includes to get the next component 503 as the “current component”, todetermine 505 a type of the current component, to select 507 anormalization process for the type of the current component, tonormalize 509 the current component per the normalization process thatwas selected, to generate 511 a fingerprint for the normalizedcomponent, to search 513 the known fingerprints for a match. This can berepeated until all of the components in the unknown component 515 areprocessed. Also, the procedure 501 can search 517 for a knownfingerprint that has a combination of internal fingerprints which issimilar to the combination of internal fingerprints of the unknowncomponent. The procedure 501 can indicate 519 the matching components.Also, the procedure 501 can prepare 521 a confidence value for one ormore of the matching components, which indicates the confidence that theunknown component (or its internal components) matches the knowncomponent(s). The process can finish 523 when evaluation of the unknowncomponent is complete.

The order indicated is not so important, provided that a component isnormalized before its fingerprint is generated, and the fingerprint isgenerated before it is matched.

Referring now to FIG. 6, a flow chart illustrating a procedure 601 toprepare the dataset of known fingerprints will be discussed anddescribed. Many of the relevant details have already been discussed, sothis provides an overview. In overview, the procedure 601 includes toobtain 603 a component from which to prepare a known fingerprint to addto the library of known fingerprints, to determine a type of the currentcomponent, to select one or more normalization processes for thecomponent that are associated with the current component's type, tonormalize 609 the component per the selected normalization process(es),to generate 611 the fingerprint(s) for the normalized component, to add613 the generated fingerprint(s) to the library of known fingerprints(if not already present) together with identification information regardthe known component's origin. Also, the procedure 601 can includeinformation indicating the known components and their inner components.Thus, the procedure 601 can add the fingerprint(s) of the component asan inner component to its outer component, if any. The procedure can berepeated 619 for the inner component of the current component until allof the inner components have been fingerprinted and stored. The processcan return when done 621.

Referring now to FIG. 7, a flow chart illustrating a procedure tonormalize a Java component will be discussed and described. This is anexample of a normalization process, which is performed when a componentis determined to be a Java file.

In this Java file normalization procedure, the procedure 701 obtains 703a Java component to be normalized. The Java component can be the outercomponent, or it can be one of the inner components. The following canbe performed on the component, in any order. The procedure 701 can set703 the class version to 0. The procedure 701 can reset 707 thesynthetic class access flags. The procedure 701 can set 709 the outerclass name to null. The procedure 701 can set 711 the constant pool andinner class list in alphabetic order. The procedure 710 can reset 713the “final” access flag of the Java enumerations #values method. Theprocedure 701 can remove 715 the synthetic member fields and methods.The procedure 701 can remove 717 package names from the component. Then,the normalization procedure can end 719.

The data mentioned in the previous paragraph are known Java data fields.The pack200/unpack200 tools are known.

The above normalization procedure for the Java component can generate auniversal fingerprint for a Java component. By “universal”, it isintended to indicate that any data introduced into the Java component bysoftware programmers while the semantic functional is retained, havebeen reduced by the normalization process, so that two Java componentswith the same provenance will match, regardless of subsequent compiles,packaging, etc.

Thus, one or more embodiments provides, for a Java component,normalizing the Java component according to a Java normalization processto provide a normalized Java component; and generating, in theprocessor, the fingerprint for the normalized Java component, as auniversal fingerprint. In this embodiment, the fingerprint is a hashvalue; and the Java normalization process performs the following on theJava component: setting class version to 0, resetting synthetic classaccess flags, setting outer class name to null, setting constant pooland inner class list in alphabetical order, resetting final access flagof Java enumerations #values method, removing all synthetic memberfields and Java methods, and removing all package names.

Example 1 Java Class Match Confidence Score

The following provides an example of scoring a matching confidence valuefor a Java class. In this example, there is an unknown class with onefield and one method. The following hashes are calculated for thisclass.

The following normalizations can be performed on Java class filecontents before calculation of hashes:

-   -   1. Class version set to 0. Class version varies depending        on-target Java compiler parameter.    -   2. Reset synthetic class access flags. Different Java compilers        set these flags differently.    -   3. Set ‘outer’ class name to null. Different Java compilers set        this attribute differently.    -   4. Sort constant pool and inner class list in alphabetical        order. pack200/unpack200 change the constant pool and inner        class list order.    -   5. Reset ‘final’ access flag of Java enumerations #values        method. Different Java compilers set this flag differently.

6. Remove all synthetic member fields and methods.

NOPKG_* hashes are calculated from input that has most fully-qualifiedJava class name references replaced with corresponding simple classname. For example, all references to “org.myproject.MyClass” arereplaced with “MyClass”. References to Java.* and Javax.* classes arepreserved. This normalization can be performed in addition to othernormalizations mentioned above.

BYTECODE, NOPKG_BYTECODE hash of entire Java class file contents

SIGNATURE, NOPKG_SIGNATURE hash of entire Java class file contents withmethod body instructions removed

TYPE, NOPKG_TYPE hash of Java type declaration

FIELD, NOPKG_FIELD hash of individual Java class file field

METHOD_SIGNATURE, NOPKG_METHOD_SIGNATURE hash of individual Java classmethod signature

METHOD, NOPKG_METHOD hash of individual Java class method, includingmethod signature and body bytecode instructions.

For example, a Java class with one field and one method can have 12hashes calculated for it:

BYTECODE

SIGNATURE

TYPE

NOPKG_BYTECODE

NOPKG_SIGNATURE

NOPKG_TYPE

FIELD

NOPKG_FIELD

METHOD_SIGNATURE

METHOD

NOPKG_METHOD_SIGNATURE

NOPKG_METHOD

The relationship among these Java hashes confidence scores can be asfollows:

Score(BYTECODE)>Score(NOPKG_BYTECODE)>Score(SIGNATURE)>Score(NOPKG_SIGNATURE)

Score(TYPE)+Sum(Score(FIELD))+Sum(Score(METHOD_SIGNATURE))+Sum(Score((METHOD))==Score(BYTECODE)

Score(TYPE)+Sum(Score(FIELD))+Sum(Score(METHOD_SIGNATURE))==Score(SIGNATURE)

Score(NOPKG_TYPE)+Sum(Score(NOPKG_FIELD))+Sum(Score(NOPKG_METHOD_SIGNATURE))+Sum(Score((NOPKG_METHOD))==Score(NOPKG_BYTECODE)

Score(NOPKG_TYPE)+Sum(Score(NOPKG_FIELD))+Sum(Score(NOPKG_METHOD_SIGNATURE))==Score(NOPKG_SIGNATURE)

The Java class match score can be calculated using the following rules.

For a known class C and unknown class U:

If the two classes match by BYTECODE hashes, match score isScore(BYTECODE).

Else, match score is calculated using the following formula and similarformula using corresponding NOPKG_hashes (not shown) and the highest ofthe two scores is used

${\frac{{M({TYPE})} + {M({FIELD})} + {M({METHODSIGNATURE})}}{1 + {C({FIELD})} + {C({METHODSIGNATURE})}}{{Score}({SIGNATURE})}} + {\frac{M({METHOD})}{C({METHOD})}{{Score}\left( {{BYTECODE} - {SIGNATURE}} \right)}}$

-   -   where M(type) is the number of matching hashes of given type,        C(type) is the total number of hashes of given type in unknown        class U and Score(type) is match score of the given hash type.

An example Java class match score calculation is provided. For thisexample, assume the following baseline match scores

99 BYTECODE

98 SIGNATURE

51 NOPKG_BYTECODE

50 NOPKG_SIGNATURE

Take an unknown class U and known class C

class U { field u_f1; method u_m1; } class C { field c_f1; method c_m1;}

If both classes have the equal BYTECODE hash, the match is 99. However,if the two classes have different Java type signature, for example, Uimplements Serializable interface and C does not, but otherwise are thesame, matching score is

${{\frac{0 + 1 + 1}{1 + 1 + 1}51} + {\frac{1}{1}\left( {99 - 51} \right)}} = 83$

If the two classes have different package names, matching score is

${{\frac{1 + 1 + 1}{1 + 1 + 1}50} + {\frac{1}{1}48}} = 98$

Example 2 Simple Example

This is a simple example to illustrate the principles discussed herein.In this simple example, an unknown component has subcomponents A, B andC; and a known component has subcomponents B and C which are in thelibrary of fingerprints for known components. The system generates afingerprint for A, fingerprint for B, fingerprint for C, and fingerprintfor unknown component (in addition to determining what kind of a file itis, and normalizing as discussed above). The system checks the libraryof known fingerprints for any match to fingerprint A, fingerprint B,fingerprint C, and/or component level fingerprint. In this example,subcomponent A was completely original and hence there is no matchingfingerprint in the library. The system will determine that there is amatch for fingerprint B and fingerprint C, but no match for fingerprintA and component level fingerprint. Then the system assigns a confidenceto the match; the confidence level of A, B and C (lowest level) ishigher than the confidence level for the overall match (to avoiddouble-counting the lack of match for A). The confidence level of, e.g.,66%, indicates the confidence for unknown component matching the knowncomponent. Optionally, the confidence level can also indicate thematching of subelements B and C. This will be useful for, for example,security vulnerabilities.

Also, what if B and C came together from another component? If B and Chappen to be class files, then the system would be looking for other JARfiles that have those class files. If B and C happen to be JAR files,the system ultimately would be trying to figure out what, exactly, are Band C? This complication is caused because the system can be matching atmultiple different levels in some cases.

Example 3 Simple Example

A second example is the same as the first example except thatsubcomponent A was known and previously fingerprinted, and the systemfound that 90 out of 100 files inside A match those files in componentF. The system can indicate that subcomponent A potentially is componentF, with the licensing and security implications of component F, becausemost of the things inside subcomponent A match component F.

These situations may occur when a developer has modified a component, ora developer has taken several components and put them together into anew component, etc.

Misc. Variation 1

Different normalization processes can be provided for files. Also,normalization processes can be provided for other file types besidesJava, to be used for normalizing components of other files types. Thetechniques used to produce the normalizing processes for Java can beextrapolated to other languages. In one example, a similar approach canbe developed to omit from a component, information which is notsemantically important. For example, by looking at the binary output for.NET components and observing which types of things within a .NETcomponent change based on the compiler or the time, this information canbe factored out to produce a fingerprint that is still unique if thosethings are taken out.

The specific normalizations can be applied to other languages and othertypes of files. In developing the normalization for the other file type,one can look at the binary files and understand what they are built outof, what the sections are, and can identify certain sections as notcontributing to the uniqueness of the file but which change every time(e.g., the time). In effect, this omits the “noise”. The system canremove this information from that file and other files of the same type.This is why different normalizations that are applied have differentconfidence levels.

In one case, the format of a file can allow for expressing the samething. For example, there are certain data structures inside a Javaclass file that do not require a particular order of elements, so itdoesn't matter what order the elements are present. As far as executionof the file, it will be exactly the same. Different compilers have thesestructures in a different order. This would be noise.

In another example, there might be a modification, such as by adeveloper to a well-known open source component and that produced binaryversion of that modified component. In this case, there will be realdifferences in the class files. When the comparison is made, e.g.,method bodies are thrown away during the normalization (referred to as“noise” for lack of a better term). That is, information is thrown awayfrom the file so that there still is a meaningful but coarse grainedassessment whether the files are similar or not.

In normalization, in some cases the system can change the order ofelements when it is known that the order is insignificant or lesssignificant. In another normalization, elements are discarded. When theorder is changed, some information is lost but not much. When elementsare discarded, more information is lost. As information is lost throughnormalization, the confidence of the match can decrease.

In summary, to develop a normalization process, the file can be brokendown into structures and then it can be determined which of thestructures do not contribute meaningfully to the match and other partsof the structure do. The structures that do contribute meaningfully tothe match can be retained in the normalized file. For example, in aclass file, the things that define the variables and the executionmatter, whereas the order of some of the other things in the class filedoes not matter, so that the initial structure does not matter. Asanother example, pieces of the file that are random, e.g., based on howor when it was compiled, do not contribute in a meaningful way to thecomponent or the match.

Misc. Variation 2

Multiple fingerprints can be generated for the same component, usingdifferent normalization processes because the different normalizationprocesses omit different, potentially useful information. The differentnormalization techniques that are applied can have different confidencelevels.

Misc. Variation 3

A file type, which can be used to determine the appropriatenormalization process, can be determined from the file extension (whichis a quick determination) and/or the file content (to make sure the filecorresponds to the expected file type). For example, the file type canbe determined from the file extension as confirmed by the file content.

Misc. Variation 4—UberJar

Sometimes software developers aggregate multiple input components into asingle stand alone JAR file which is sometimes referred to as anUberJar. An “UberJar” is a single component into which the contents ofmany components have been unpacked and then reassembled. An example ofan UberJar is two JAR files which are unzipped, and then rezipped into anew zipped file which is the UberJar.

There are UberJars that are present in source repositories of knowncomponents that the system is scanning (e.g., for developing the dataset), and also in applications themselves that are being evaluated for amatch might include an UberJar. In order to distinguish among UberJarsof unknown components, an UberJar can be punished when scored so theUberJar is scored lower in the confidence calculation, than the originalcomponents they were created from.

A known UberJar plug-in can package components and their dependenciesinto a single JAR file, add bootstrap code to enable a main class to beinvoked, load dependencies, execute a main method, enable dependent JARsto be inserted into the classpath, and locate the JARs, all within theUberJar. Thus, a software developer can take components A and B thatmight not be related and package them into an UberJar.

Because the UberJar typically represents an arbitrary software developerconvenience, and not a-construct related to the actual product, there isno reason to increase the confidence level already provided by itscontents matching, when UberJar hashes match.

Security risk of a software component is referred to herein, andgenerally encompasses software vulnerabilities and security. The MitreCVE (Common Vulnerabilities and Exposures) list and NIST NVD (NationalVulnerability Database) and other organizations conventionally providetext information about vulnerabilities and security of commercialsoftware applications. The CVE list and NVD database indicate commercialsoftware application names and versions or version ranges which may ormay not readily map to software components. Furthermore, the CVE and NVDrating of vulnerabilities is based on the seriousness of thevulnerability.

Licenses are referred to herein. Well known in the open source field isthat a license can be associated with a component. The method or systemcan collect the identity of the license or the content of the license,which is listed for example in the project such as in the POM associatedwith the component. The license further can indicate permitted andprohibited activities. (There are a several pre-determined open-sourcelicenses in common use as well as variations thereof, as well as somecustomized licenses.)

The detailed descriptions which appear above may be presented in termsof program procedures executed on a computer or network of computers.These procedural descriptions and representations herein are the meansused by those skilled in the art to most effectively convey thesubstance of their work to others skilled in the art.

Further, an embodiment has been discussed in certain examples as if itis made available by a provider to a single customer with a single site.An embodiment may be used by numerous users, if preferred, and the userscan be at one or more sites.

The system used in connection herewith may rely on the integration ofvarious components including, as appropriate and/or if desired, hardwareand software servers, applications software, database engines, serverarea networks, firewall and SSL security, production back-up systems,and/or applications interface software.

A procedure is generally conceived to be a self-consistent sequence ofsteps leading to a desired result. These steps are those requiringphysical manipulations of physical quantities. Usually, though notnecessarily, these quantities take the form of electrical or magneticsignals capable of being stored on non-transitory computer-readablemedia, transferred, combined, compared and otherwise manipulated. Itproves convenient at times, principally for reasons of common usage, torefer to these signals as bits, values, elements, symbols, characters,terms, numbers, or the like. It should be noted, however, that all ofthese and similar terms are to be associated with the appropriatephysical quantities and are merely convenient labels applied to thesequantities.

Further, the manipulations performed are often referred to in terms suchas adding or comparing, which are commonly associated with mentaloperations performed by a human operator. While the discussion hereinmay contemplate the use of an operator, a human operator is notnecessary, or desirable in most cases, to perform the actual functionsdescribed herein; the operations are machine operations.

Various computers or computer systems may be programmed with programswritten in accordance with the teachings herein, or it may prove moreconvenient to construct a more specialized apparatus to perform therequired method steps. The required structure for a variety of thesemachines will appear from the description given herein.

Furthermore, the communication networks of interest for communicatingbetween computers onto which some embodiments may be distributed includethose that transmit information in packets, for example, those known aspacket switching networks that transmit data in the form of packets,where messages can be divided into packets before transmission, thepackets are transmitted, and the packets are routed over networkinfrastructure devices to a destination where the packets are recompiledinto the message. Such networks include, by way of example, theInternet, intranets, local area networks (LAN), wireless LANs (WLAN),wide area networks (WAN), and others. Protocols supporting communicationnetworks that utilize packets include one or more of various networkingprotocols, such as TCP/IP (Transmission Control Protocol/InternetProtocol), Ethernet, X.25, Frame Relay, ATM (Asynchronous TransferMode), IEEE 802.11, UDP/UP (Universal Datagram Protocol/UniversalProtocol), IPX/SPX (Inter-Packet Exchange/Sequential Packet Exchange),Net BIOS (Network Basic Input Output System), GPRS (general packet radioservice), I-mode and other wireless application protocols, and/or otherprotocol structures, and variants and evolutions thereof. Such networkscan provide wireless communications capability and/or utilize wirelineconnections such as cable and/or a connector, or similar.

This disclosure is intended to explain how to fashion and use variousembodiments in accordance with the invention rather than to limit thetrue, intended, and fair scope and spirit thereof. The invention isdefined solely by the appended claims, as they may be amended during thependency of this application for patent, and all equivalents thereof.The foregoing description is not intended to be exhaustive or to limitthe invention to the precise form disclosed. Modifications or variationsare possible in light of the above teachings. The embodiment(s) waschosen and described to provide the best illustration of the principlesof the invention and its practical application, and to enable one ofordinary skill in the art to utilize the invention in variousembodiments and with various modifications as are suited to theparticular use contemplated. All such modifications and variations arewithin the scope of the invention as determined by the appended claims,as may be amended during the pendency of this application for patent,and all equivalents thereof, when interpreted in accordance with thebreadth to which they are fairly, legally, and equitably entitled.

1. A computer system that identifies components, comprising: a componentfingerprint storage configured to memorize known fingerprints of knowncomponents; and a processor cooperatively operable with the componentfingerprint storage, and configured to facilitate: determining allcomponents included within an unknown component; generating fingerprintsfor all components determined to be included in the unknown component;determining whether any of the fingerprints generated for the componentsincluded in the unknown component match any of the known fingerprints ofknown components; and determining whether the unknown component matchesany of the known components based on matching of the known fingerprintsof the components included in the unknown component.
 2. The computersystem of claim 1, further comprising generating the known fingerprintsof known components and then storing the known fingerprints in thecomponent fingerprint storage.
 3. The computer system of claim 1,wherein the fingerprints are hash values.
 4. The computer system ofclaim 1, further comprising normalizing the unknown component and all ofthe components included in the unknown component, before generating thefingerprints for the unknown component and the components included inthe unknown component.
 5. The computer system of claim 4, furthercomprising for each of the components in the unknown component, beforenormalizing the component, determining a type of the component anddetermining a normalization process associated with the type of thecomponent, wherein the component is normalized according to thenormalization process determined to be associated with the type of thecomponent.
 6. A computer system that identifies components, comprising:a component fingerprint storage configured to memorize knownfingerprints of known components; and a processor cooperatively operablewith the component fingerprint storage, and configured to facilitate:determining all components included within an unknown component;generating fingerprints for all components determined to be included inthe unknown component; determining whether any of the fingerprintsgenerated for the components included in the unknown component match anyof the known fingerprints of known components; determining whether theunknown component matches any of the known components based on matchingof the known fingerprints of the components included in the unknowncomponent; normalizing the unknown component and all of the componentsincluded in the unknown component, before generating the fingerprintsfor the unknown component and the components included in the unknowncomponent; and for each of the components in the unknown component,before normalizing the component, determining a type of the componentand determining a normalization process associated with the type of thecomponent, wherein the component is normalized according to thenormalization process determined to be associated with the type of thecomponent, wherein the normalization process for a component which isdetermined to be a Java type performs the following: set class versionto 0, reset synthetic class access flags, set outer class name to null,set constant pool and inner class list in alphabetical order, resetfinal access flag of Java enumerations #values method, remove allsynthetic member fields and Java methods, and remove all package names.7. (canceled)
 8. A computer-implemented method for identifying acomponent, comprising: memorizing, in a component fingerprint storage,known fingerprints of known components; determining, in a processor, allcomponents included within an unknown component; generating, in theprocessor, fingerprints for all components determined to be included inthe unknown component; determining, in the processor, whether any of thefingerprints generated for the components included in the unknowncomponent match any of the known fingerprints of known components of thecomponent fingerprint storage; and determining, in the processor,whether the unknown component matches any of the known components basedon matching of the known fingerprints of the components included in theunknown component.
 9. The method of claim 8, further comprisinggenerating the known fingerprints of known components and then storingthe known fingerprints in the component fingerprint storage.
 10. Themethod of claim 8, wherein the fingerprints are hash values.
 11. Themethod of claim 8, further comprising normalizing the unknown componentand all of the components included in the unknown component, beforegenerating the fingerprints for the unknown component and the componentsincluded in the unknown component.
 12. The method of claim 11, furthercomprising for each of the components in the unknown component, beforenormalizing the component, determining a type of the component anddetermining a normalization process associated with the type of thecomponent, wherein the component is normalized according to thenormalization process determined to be associated with the type of thecomponent.
 13. A computer-implemented method for identifying acomponent, comprising: memorizing, in a component fingerprint storage,known fingerprints of known components; determining, in a processor, allcomponents included within an unknown component; generating, in theprocessor, fingerprints for all components determined to be included inthe unknown component; determining, in the processor, whether any of thefingerprints generated for the components included in the unknowncomponent match any of the known fingerprints of known components of thecomponent fingerprint storage; determining, in the processor, whetherthe unknown component matches any of the known components based onmatching of the known fingerprints of the components included in theunknown component; normalizing the unknown component and all of thecomponents included in the unknown component, before generating thefingerprints for the unknown component and the components included inthe unknown component; and for each of the components in the unknowncomponent, before normalizing the component, determining a type of thecomponent and determining a normalization process associated with thetype of the component, wherein the component is normalized according tothe normalization process determined to be associated with the type ofthe component, wherein the normalization process for a component whichis determined to be a Java type performs the following: setting classversion to 0, resetting synthetic class access flags, setting outerclass name to null, setting constant pool and inner class list inalphabetical order, resetting final access flag of Java enumerations#values method, removing all synthetic member fields and Java methods,and removing all package names.
 14. (canceled)
 15. A non-transitorycomputer-readable medium comprising instructions for execution by acomputer, the instructions including a computer-implemented method foridentifying a component, the instructions for implementing: memorizing,in a component fingerprint storage, known fingerprints of knowncomponents; determining, in a processor, all components included withinan unknown component; generating, in the processor, fingerprints for allcomponents determined to be included in the unknown component;determining, in the processor, whether any of the fingerprints generatedfor the components included in the unknown component match any of theknown fingerprints of known components of the component fingerprintstorage; and determining, in the processor, whether the unknowncomponent matches any of the known components based on matching of theknown fingerprints of the components included in the unknown component.16. The non-transitory computer-readable medium of claim 15, furthercomprising generating the known fingerprints of known components andthen storing the known fingerprints in the component fingerprintstorage.
 17. The non-transitory computer-readable medium of claim 15,wherein the fingerprints are hash values.
 18. The non-transitorycomputer-readable medium of claim 15, further comprising normalizing theunknown component and all of the components included in the unknowncomponent, before generating the fingerprints for the unknown componentand the components included in the unknown component.
 19. Thenon-transitory computer-readable medium of claim 18, further comprisingfor each of the components in the unknown component, before normalizingthe component, determining a type of the component and determining anormalization process associated with the type of the component, whereinthe component is normalized according to the normalization processdetermined to be associated with the type of the component.
 20. Anon-transitory computer-readable medium comprising instructions forexecution by a computer, the instructions including acomputer-implemented method for identifying a component, theinstructions for implementing: memorizing, in a component fingerprintstorage, known fingerprints of known components; determining, in aprocessor, all components included within an unknown component;generating, in the processor, fingerprints for all components determinedto be included in the unknown component; determining, in the processor,whether any of the fingerprints generated for the components included inthe unknown component match any of the known fingerprints of knowncomponents of the component fingerprint storage; determining, in theprocessor, whether the unknown component matches any of the knowncomponents based on matching of the known fingerprints of the componentsincluded in the unknown component; normalizing the unknown component andall of the components included in the unknown component, beforegenerating the fingerprints for the unknown component and the componentsincluded in the unknown component; and for each of the components in theunknown component, before normalizing the component, determining a typeof the component and determining a normalization process associated withthe type of the component, wherein the component is normalized accordingto the normalization process determined to be associated with the typeof the component, wherein the normalization process for a componentwhich is determined to be a Java type performs the following: settingclass version to 0, resetting synthetic class access flags, settingouter class name to null, setting constant pool and inner class list inalphabetical order, resetting final access flag of Java enumerations#values method, removing all synthetic member fields and Java methods,and removing all package names.
 21. (canceled)
 22. Acomputer-implemented method for generating a universal fingerprint for aJava component, comprising, in this order: for a Java component, in aprocessor, normalizing the Java component according to a Javanormalization process to provide a normalized Java component; andgenerating, in the processor, the fingerprint for the normalized Javacomponent, as a universal fingerprint, wherein the fingerprint is a hashvalue, and the Java normalization process performs the following on theJava component: setting class version to 0, resetting synthetic classaccess flags, setting outer class name to null, setting constant pooland inner class list in alphabetical order, resetting final access flagof Java enumerations #values method, removing all synthetic memberfields and Java methods, and removing all package names.